﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite.Modularity;
using MyApp.Infrastructure.Messages;
using Microsoft.Practices.ServiceLocation;
using MyApp.Modules.Orders.Views;
using MyApp.Modules.Orders.Menu;
using Microsoft.Practices.Unity;
using MyApp.Data.Model;
using MVVMFramework.Core.ViewModel;
using MyApp.Modules.Orders.ViewModels;
using MVVMFramework.Core.View;

namespace MyApp.Modules.Orders
{
    public class Module : IModule
    {
        private IUnityContainer container;

        public Module(IUnityContainer container)
        {
            this.container = container;
        }

        #region IModule Members

        public void Initialize()
        {
            #region Register ViewModels / Views

            container.RegisterType<IListVM<Product>, ProductListVM>();
            container.RegisterType<IListView<Product>, ProductListView>();

            #endregion

            Messenger.Get<MenuOptionMessage>().Publish(new MenuOptionMessageArgs
            {
                Command = Commands.NewOrderCommand, 
                Text = "Create New Order", 
                Group = "Orders"
            });
            Messenger.Get<MenuOptionMessage>().Publish(new MenuOptionMessageArgs
            {
                Command = Commands.ViewOrdersCommand,
                Text = "View Orders",
                Group = "Orders"
            });
        }

        #endregion
    }
}
